package com.example;

import org.apache.kafka.clients.producer.ProducerInterceptor;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.clients.producer.RecordMetadata;

import java.util.Map;

public class InterceptorDemo implements ProducerInterceptor<String,String> {
    @Override
    public ProducerRecord<String, String> onSend(ProducerRecord<String, String> record) {
        if (100%10==0){
            throw  new RuntimeException("GGGG");
        }
        return record;
    }

    @Override
    public void onAcknowledgement(RecordMetadata metadata, Exception exception) {
        System.err.println("onsend handler");
    }

    @Override
    public void close() {
        System.err.println("close handler");
    }

    @Override
    public void configure(Map<String, ?> configs) {
        System.err.println("handler configs");
    }
}
